package cn.tiancaifan.micro.service;


import cn.tiancaifan.micro.entity.Job;
import cn.tiancaifan.micro.mapper.JobMapper;
import cn.tiancaifan.micro.utils.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class JobService {

    @Autowired
    JobMapper jobMapper;


    public List<Job> getAllJobs(){
        return jobMapper.getAllJobs();
    }

    @Logger("修改职位")
    public int updataJob(Job job) {
        int i = jobMapper.updataJob(job);
        return i;
    }

    @Logger("添加职位")
    public int addJob(Job job) {
        job.setCreateDate(new Date());
        return jobMapper.addJob(job);
    }

    @Logger("删除职位")
    public int deleteJobById(Integer id) {
        return jobMapper.deleteJobById(id);
    }

    @Logger("批量删除职位")
    public int deleteJobsByIds(Integer[] ids) {
        return jobMapper.deleteJobByIds(ids);
    }
}
